﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Event.Services;
using Event.Models;

namespace Event.ViewModels;

[ObservableObject]
public partial class MainPageViewModel {
    private readonly IPoetryService _poetryService;

    public MainPageViewModel(IPoetryService poetryService) {
        _poetryService = poetryService;
    }

    [RelayCommand]
    private void AddPoetry() {
        var id = (int)DateTime.Now.Ticks;
        var poetry = new Poetry {
            Id = id, Name = $"Name {id}", Content = $"Content {id}"
        };
        _poetryService.AddPoetry(poetry);
    }
}